<%@ page language="java" import="cn.ac.iscas.bean.project.Project,java.util.Set,cn.ac.iscas.bean.PageView"  pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>论文选择课题</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
    <link rel="stylesheet" href="../../css/vip.css" type="text/css">
    <SCRIPT language=JavaScript src="../../js/jquery.js"></SCRIPT>
  <SCRIPT language=JavaScript src="../../js/FoshanRen.js"></SCRIPT>
  <link rel="stylesheet" type="text/css" href="../../js/extjs/resources/css/ext-all.css"/>
<script type="text/javascript" charset="utf-8" src="../../js/extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/extjs/ext-all.js"></script>
<script language="JavaScript">
	function deleteItem(projectId,paperId){
	 if(confirm("你确定要删除")){
	    $.get("projectBindAction_deleteProjectBind?project.id="+projectId+"&paper.id="+paperId,
	    function(data){
	    $("#"+projectId).remove();
	    alert(data);
	    });
      }
    }
  </script>
  <script language="JavaScript">
	function topage(page){
	var s="<s:url action='projectBindAction_showSelection' namespace='/admin/paper'/>?projectQuery.projectNo=<s:property value='projectQuery.projectNo'/>"
	+"&projectQuery.projectName=<s:property value='projectQuery.projectName'/>"
	+"&projectQuery.reposiblePerson=<s:property value='projectQuery.reposiblePerson'/>"
	+"&projectQuery.personInCharge=<s:property value='projectQuery.personInCharge'/>"
	+"&projectQuery.state=<s:property value='projectQuery.state'/>"
	+"&paper.id=<s:property value='paper.id'/>"
	+"&page="+page;
	javascript:window.location.href=s;
	}
  </script>
<script type="text/javascript"charset="utf-8">
function test(){
Ext.Ajax.request({
url: "project_test.action",
success: function(response, config){
alert(config.url + "," + config.method);
Ext.MessageBox.alert("result", response.responseText);
},
failure: function(){
Ext.MessageBox.alert("result", "请求失败");
},
method: "post",
params: {name: "李赞红"}
});
}
</script>
  </head>
  <body>
  
  <table  width="98%" border="0" cellspacing="1" cellpadding="3" align="center">
  <tr bgcolor="6f8ac4">
  <td>论文<font color="#FF0000"><s:property value='paper.paperTittle'/></font>已选择的项目</td>
  </tr>
  </table>
  <table  width="98%" border="0" cellspacing="1" cellpadding="3" align="center">
   <tr>
      <td width="7%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">项目课题编号</font></div></td>
      <td width="7%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">项目名称</font></div></td>
      <td width="5%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">删除</font></div></td>
    </tr>
  <s:iterator value="#selectedProjects">
  <tr id="<s:property value="id"/>">
  <td bgcolor="f5f5f5"><div align="center"><s:property value="projectNo"/></div></td>
  <td bgcolor="f5f5f5"><div align="center"><s:property value="projectName"/></div></td>
  <td bgcolor="f5f5f5"> <div align="center"><input type="button" class="frm_btn" value="删除" onClick="deleteItem(<s:property value="id"/>,<s:property value='paper.id'/>)"/></div></td> 
  </tr>
   </s:iterator>
  </table>
 
  <s:form action="projectBindAction_showSelection" namespace="/admin/paper" method="post">
  <s:hidden name="paper.id"/>
 <table width="98%" border="0" cellspacing="1" cellpadding="3" align="center">
    <tr bgcolor="6f8ac4"> 
       <td colspan="5" ><font color="#FFFFFF">请您查询论文<font color="#FF0000"><s:property value='paper.paperTittle'/></font>要选择的课题（请选择其中的一个或多个条件进行查询）：</font></td>
    </tr>
    <tr > 
      <td> <div align="right">项目编号 ：</div></td>
      <td><s:textfield name="projectQuery.projectNo" size="30" maxlength="40"/></td>
      <td> <div align="right">项目名称 ：</div></td>
      <td><s:textfield name="projectQuery.projectName" size="50" maxlength="40"/></td>
      <td> <div align="right">负责人：</div></td>
      <td><s:textfield name="projectQuery.reposiblePerson" size="20" maxlength="20"/></td>
    </tr>
    <tr > 
      <td> <div align="right">责任人 ：</div></td>
      <td><s:textfield name="projectQuery.personInCharge" size="20" maxlength="20"/></td>
      <td> <div align="right">项目状态  ：</div></td>
      <td> 
      <s:select name="projectQuery.state" list="#{'申请中':'申请中','进行中':'进行中','已结题':'已结题'}" headerValue="---请选择项目状态---" headerKey="">
      </s:select>
      </td>
    </tr>
    <tr > 
      <td colspan="2"> <div align="center"> 
          <input type="submit" name="edit" value="查询" class="frm_btn">
          &nbsp;&nbsp;<input type="button" name="Button" value=" 返 回 " class="frm_btn" onclick="javascript:history.back()">
        </div></td>
    </tr>
  </table>
</s:form>
<s:form action="projectBindAction_selectProject" namespace="/admin/paper" method="post">
 <s:hidden name="paper.id"/>
  <table width="98%" border="0" cellspacing="1" cellpadding="2" align="center">
    <tr ><td colspan="10"  bgcolor="6f8ac4" align="right">
    	<%@ include file="/WEB-INF/page/shared/fenye.jsp" %>
   </td></tr>
    <tr>
      <td width="7%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">选择课题</font></div></td>
      <td width="7%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">项目课题编号</font></div></td>
      <td width="20%" bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">课题名称</font></div></td>
	  <td width="12%" nowrap bgcolor="6f8ac4"> <div align="center"><font color="#FFFFFF">负责人</font></div></td>
	  <td width="7%" bgcolor="6f8ac4"><div align="center"><font color="#FFFFFF">责任人</font></div></td>
      <td width="6%" bgcolor="6f8ac4"><div align="center"><font color="#FFFFFF">项目的状态</font></div></td>
       <td width="6%" bgcolor="6f8ac4"><div align="center"><font color="#FFFFFF">详细信息查询</font></div></td>
    </tr>
    <%Set<Project> projects = (Set<Project>)request.getAttribute("selectedProjects");%>
   <% PageView<Project> pageView = (PageView<Project>)request.getAttribute("pageView");
   for(Project project:pageView.getRecords())
   {
     boolean contains = false;
     for(Project p:projects)
     {
        if(p.getId() == project.getId())
        contains = true;
     }%>
    <tr id="<s:property value='id'/>">
      
      <%if(projects!=null&&contains){%>
     <td bgcolor="f5f5f5"> <div align="center"> <input value=<%=project.getId()%> type=checkbox name=projectId checked="checked" disabled="disabled"/></div></td>
      <%}
      else{%>
     <td bgcolor="f5f5f5"> <div align="center">   <input value=<%=project.getId()%> type=checkbox name=projectId /></div></td>
      <%}%>
      <td bgcolor="f5f5f5"> <div align="center"><%=project.getProjectNo()%></div></td>
	  <td bgcolor="f5f5f5"> <div align="center"><%=project.getProjectName()%></div></td>
	  <td bgcolor="f5f5f5"> <div align="center"><%=project.getReposiblePerson()%></div></td>
	  <td bgcolor="f5f5f5"> <div align="center"><%=project.getPersonInCharge()%></div></td>
	  <td bgcolor="f5f5f5"> <div align="center"><%=project.getState()%></div></td>
	  <td bgcolor="f5f5f5"> <div align="center"><a href='<s:url action="projectManage_detailQuery" namespace="/admin"><s:param name="project.id" value="%{<%=project.getId()%>}"></s:param></s:url>'>项目详细信息</a></div></td>
	</tr>
	<%}%>
    <tr>
     <td colspan="2"> <div align="center"> 
          <input type="submit" name="edit" value="选择提交" class="frm_btn">
          &nbsp;&nbsp;<input type="button" name="Button" value=" 返 回 " class="frm_btn" onclick="javascript:history.back()">
        </div></td>	
    </tr>
  </table>
  </s:form>
  </body>
</html>
